@extends('backend::common.common_right')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <a href="{{url('backend/appcreate/0')}}"
                                type="button" class="btn btn-primary">
                            添加软件
                        </a>
                    </div>
                    <div class="ibox-content">
                        {{--模态框--}}
                        <div class="">
                            <div class="modal fade" id="myModal" aria-labelledby="myModelLabel" tabindex="-1"
                                 role="dialog" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content animated bounceInRight">

                                    </div>
                                </div>
                            </div>
                        </div>
                        {{--模态框--}}
                        <table class="table table-bordered">
                            <thead>
                            <th>软件ID</th>
                            <th>软件名称</th>
                            <th>分类</th>
                            <th>下载地址</th>
                            <th>操作</th>
                            </thead>
                            @foreach($apps as $c)
                            <tr>
                                <td>{{ $c->id }}</td>
                                <td>{{ $c->title }}</td>
                                <td>{{ $c->appcat->catname }}</td>
                                <td>{{ $c->downurl }}</td>
                                <td class="center">
                                    <a href="{{url('backend/appcreate')}}/{{$c->id}}"><i class="fa fa-pencil"></i>编辑</a>
                                    <a href="javascript:;" onclick="del({{$c->id}})"><i class="fa fa-trash"></i>删除</a>
                                </td>
                            </tr>
                            @endforeach
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <script>
        $('.catshow').hide();
        var catshow = function (id) {
            var display =$('.catshow'+id).css('display');
            if(display == 'none'){
                $('.catshow'+id).show();
            }else{
                $('.catshow'+id).hide();
            }
        }
        var del = function (id) {
            layer.confirm('确定删除么(不可恢复)？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                window.location.href = "{{url('backend/appdel')}}/"+ id;
            }, function () {

            });
        }
    </script>
@endsection

